function TodoCtrl($scope, $http, $templateCache) {
	$scope.todos = [ {
		text : 'learn angular',
		done : false
	}, {
		text : 'build an angular app',
		done : false
	} ];

	$scope.addTodo = function() {
		$scope.todos.push({
			text : $scope.todoText,
			done : false
		});
		$scope.todoText = '';
		$scope.fetch();
	};

	$scope.remaining = function() {
		var count = 0;
		angular.forEach($scope.todos, function(todo) {
			count += todo.done ? 0 : 1;
		});
		return count;
	};

	$scope.archive = function() {
		var oldTodos = $scope.todos;
		$scope.todos = [];
		angular.forEach(oldTodos, function(todo) {
			if (!todo.done)
				$scope.todos.push(todo);
		});
	};

	// $scope.method = 'GET';
	$scope.method = 'JSONP';
	$scope.valu = '';

	$scope.url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AAPL%22)&env=store://datatables.org/alltableswithkeys&format=json&callback=$scope.foo";
	// +
	// "select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AAPL%22)"
	// + "&env=store://datatables.org/alltableswithkeys&format=json";
	// $scope.url =
	// "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20upcoming.events%20where%20woeid%20in%20(select%20woeid%20from%20geo.places%20where%20text%3D%22North%20Beach%22)&format=json&callback=foo";
	$scope.fetch = function() {
		$scope.code = null;
		$scope.response = null;

		$http({
			method : $scope.method,
			url : $scope.url,
			cache : $templateCache
		}).success(function(data, status) {
			$scope.status = status;
			$scope.data = data;
			alert('success');
			// $scope.valu = data.query.count;
		}).error(function(data, status) {
			// $scope.data = data || "Request failed";
			$scope.status = status;
			
		});
	};
	$scope.foo = function(resp) {
		alert(resp.query.created);
	};
	/*
	 * $scope.updateModel = function(method, url) { $scope.method = method;
	 * $scope.url = url; };
	 */

}
foo = function(resp) {
	alert(resp.query.created);
};
/*
 * function foo(resp) {
 * 
 * alert(resp.query.created);}
 */